//
//  ListCell.m
//  Travel_M_Travel
//
//  Created by dlios on 15-3-25.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ListCell.h"
#import "UIImageView+WebCache.h"
@implementation ListCell

- (void)dealloc
{
    [_albumCoverUrl290 release];
    [_title release];
    [_playsCounts release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier ];
    if (self) {
        
        self.albumCoverUrl290 = [[UIImageView alloc] init];
        _albumCoverUrl290.backgroundColor = [UIColor cyanColor];
        self.albumCoverUrl290.frame = CGRectMake(5, 5, self.contentView.frame.size.width/3, self.contentView.frame.size.height + 30);
        NSLog(@"%f",self.contentView.frame.size.height);
        [self.contentView addSubview:_albumCoverUrl290];
        [_albumCoverUrl290 release];
        
        
        self.title = [[UILabel alloc] init];
         self.title.frame = CGRectMake(self.contentView.frame.size.width/2-30, 30, self.contentView.frame.size.width*2/3, self.contentView.frame.size.height/4);
        [self.contentView addSubview:_title];
        [_title release];
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.contentView.frame.size.width/2-20, 52, self.contentView.frame.size.width/20, self.contentView.frame.size.height/4+5)];
        [imageView setImage:[UIImage imageNamed:@"play.png"]];
        [self.contentView addSubview:imageView];
        [imageView release];
        
        
        
        self.playsCounts = [[UILabel alloc] init];
        self.playsCounts.frame = CGRectMake(self.contentView.frame.size.width/2, 35+self.contentView.frame.size.height/3, self.contentView.frame.size.width/5, self.contentView.frame.size.height/5 + 10);
        self.playsCounts.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_playsCounts];
        [_playsCounts release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    NSString *str = self.list.albumCoverUrl290;
    str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:str];
    [self.albumCoverUrl290 setImageWithURL:url];
    
   
    self.title.text = self.list.title;
    
    NSString *str1 = [NSString stringWithFormat:@"%@", self.list.playsCounts];
    self.playsCounts.text = str1;
    NSLog(@"!!>><>><>>%@", self.playsCounts.text);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
